package cn.frank.util;

import cn.frank.service.WebSocketService;
import cn.frank.service.mysql.ISalesDatasService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author Frank
 * @date 05-28
 */
public class DataRefreshJob implements Job {
    @Autowired
    private WebSocketService webSocketService;

    @Autowired
    private ISalesDatasService salesDatasService;
    @Override
    public void execute(JobExecutionContext context) {
        // 假设有一个方法来获取最新数据
        System.out.println("发送数据库数据。。。。");
        Object data = salesDatasService.findSalesData();
        webSocketService.sendMessage("/topic/sales", data);
    }
}
